<!doctype html>
<html lang="en">
<head>
    <meta name="baidu-site-verification" content="code-zVh15bKvoe" />
    <meta charset="UTF-8">
    <meta name="keywords" content="最新电视剧免费在线观看_电视剧大全,M3U8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
<script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?61ce2c31f6905bf083216c37fda2e63c";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>
<!-- <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests"> -->
<title>M3U8在线播放器_最新电视剧免费在线观看_电视剧大全</title>
<link rel="stylesheet" href="./DPlayer.min.css">
<script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
	<style> 
        input[type=text] {
          display: inline;
          width: 80%;
          box-sizing: border-box;
          border: 2px solid #ccc;
          border-radius: 4px;
          font-size: 16px;
          background-color: white;
          background-image: url('https://static.runoob.com/images/mix/searchicon.png');
          background-position: 10px 10px; 
          background-repeat: no-repeat;
          padding: 12px 20px 12px 40px;
        }
        #grad1 {
        height: 100rem;
          background-repeat: no-repeat;
          background-image: linear-gradient( 135deg, #303958 10%, #208072 100%);
        }
        .button {
        background-color: #4CAF50; /* Green */
        border: none;
        color: white;
        padding: 15px 32px;
        text-align: center;
        text-decoration: none;
        display: inline-block;
        font-size: 16px;
        margin: 4px 2px;
        cursor: pointer;
        -webkit-transition-duration: 0.4s; /* Safari */
        transition-duration: 0.4s;
        }
        .button2:hover {
         box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19);
        }
        h1
        {
            text-shadow: 5px 5px 5px #9198e5;
            text-align: center;
            color: #ccc;
        }
        /* 下拉按钮样式 */
        .dropbtn {
            background-color: #4CAF50;
            color: white;
            padding: 15px;
            font-size: 16px;
            border: none;
            cursor: pointer;
        }

        /* 容器 <div> - 需要定位下拉内容 */
        .dropdown {
            position: relative;
            display: inline-block;
        }

        /* 下拉内容 (默认隐藏) */
        .dropdown-content {
            display: none;
            position: absolute;
            background-color: #f9f9f9;
            overflow-y: scroll;
            width: 110px;
            height: 200px;  
            box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
        }

    
    /* #test::-webkit-scrollbar {
      width: 10px;
    }
    
    #test::-webkit-scrollbar-thumb {
      background: #ccc;
      border-radius: 10px;
    } */


        /* 下拉菜单的链接 */
        .dropdown-content a {
            color: black;
            padding: 12px 15px;
            text-decoration: none;
            display: block;
        }

        /* 鼠标移上去后修改下拉菜单链接颜色 */
        .dropdown-content a:hover {background-color: #f1f1f1}

        /* 在鼠标移上去后显示下拉菜单 */
        .dropdown:hover .dropdown-content {
            display: block;
        }

        /* 当下拉内容显示后修改下拉按钮的背景颜色 */
        .dropdown:hover .dropbtn {
            background-color: #3e8e41;
        }
	.iframe { 
	  body { 
	    ::-webkit-scrollbar-thumb {
		background-color: #EFEFF0;
		border: 1px solid transparent;
		background-clip: padding-box;
		border-radius: 5px;
	    }        
	  }
	}
        </style>
 <script src="./jquery.js" type="text/javascript"></script>      
</head>
<body id="grad1">
<h1>M3U8在线播放器</h1>
<div id="dplayer"></div>
<div style="left: 50%;text-align: center;">
<div class="dropdown">
<button class="dropbtn">国内直播源</button>
<div class="dropdown-content" id="test">

</div>
</div>
<input id="src" type="text" placeholder="请输入要播放的m3u8链接...如:xxx.m3u8" >
<button class="button button2" type="button" onclick="myFunction()">播放</button>
<p style="color: white;font-size:1em;">本站支持电视m3u8的直播<br/>本网站只做学习交流，数据来源网络，请不要进行任何违法操作，非法进行其他操作与本人无关！欢迎转发分享！<br/>联系QQ:2475117070</p>
<p id="demo" style="color: forestgreen;font-size:2.5em;"></p>
<span id="busuanzi_container_site_pv">
	<h1><a href="https://kanjuwang.net/" style="color: white;font-size:1em;" target="_blank">在线观影</a></h1><br>
                <!-- 本站总访问量<span id="busuanzi_value_site_pv"></span>次</span> -->
	<img src="https://raw.githubusercontent.com/linqingping/M3U8-player/master/368869202.jpg" width="300" height="400">
	</div>
<!-- <a href="https://kanjuwang.net/" style="color: white;font-size:1em;" target="_blank">在线观影</a> -->
<!-- <a id=index href='#showmain' style="text-decoration:none"><font color='#EFFBEF'>观影模式</font></a> -->
<!-- <iframe marginheight=0 marginwidth=0 frameborder=0 width=100% style="overflow-x:hidden;" height=100% scrolling=auto src="https://kanjuwang.net/" name=showmain id=showmain onload="resize();">不能正常显示</iframe> -->
</body>
</html>
<script language="javascript">
    var iframeids = ["showmain"];
    var iframehide = "yes";
    
    function dyniframesize() {
     var dyniframe = new Array();
     for (i = 0; i < iframeids.length; i++) {
     
      if (document.getElementById) {
       dyniframe[dyniframe.length] = document.getElementById(iframeids[i]);
       if (dyniframe[i] && !window.opera) {
        dyniframe[i].style.display = "block";
        if (dyniframe[i].contentDocument && dyniframe[i].contentDocument.body.offsetHeight) {
         dyniframe[i].height = dyniframe[i].contentDocument.body.offsetHeight;
        } else {
         if (dyniframe[i].Document && dyniframe[i].Document.body.scrollHeight) {
          dyniframe[i].height = dyniframe[i].Document.body.scrollHeight;
         }
        }
       }
      }
      if ((document.all || document.getElementById) && iframehide == "no") {
       var tempobj = document.all ? document.all[iframeids[i]] : document.getElementById(iframeids[i]);
       tempobj.style.display = "block";
      }
     }
    }
    function resize() {
     dyniframesize();
     parent.dyniframesize();
    }
   
    if (window.addEventListener) {
     window.addEventListener("load", dyniframesize, false);
    } else {
     if (window.attachEvent) {
      window.attachEvent("onload", dyniframesize);
     } else {
      window.onload = dyniframesize;
     }
    }
    </script>
<script src="./hls.min.js"></script>
<script src="./DPlayer.min.js"></script>
<script>
    var url;
    var islive;
    islive=false;
    function changelive(value,channel){
        document.getElementById("src").value=value
        url = document.getElementById("src").value;
	      document.getElementById("src").value=""
        document.getElementById("demo").innerHTML = "播放加载时间有可能慢些请耐心等待，长时间未播放可能链接地址不可用<br/>当前播放："+channel;
        const dp = new DPlayer({
        container: document.getElementById('dplayer'),
        autoplay: true,
        live:true,
        screenshot: true,
            video: {
                //url: document.getElementById("src").value,
                url: url,
            type: 'hls'
            },
            pluginOptions:{
                hls:{
                },
            },
        });
    }
    
    setTimeout("load()", 5000);
    function load(){
    document.getElementById("index").click();
    }
	
    function myFunction() {
    url = document.getElementById("src").value;
    document.getElementById("demo").innerHTML = "播放加载时间有可能慢些请耐心等待，长时间未播放可能链接地址不可用<br/>当前播放："+url;
    const dp = new DPlayer({
    container: document.getElementById('dplayer'),
	autoplay: true,
    live:false,
	screenshot: true,
        video: {
            //url: document.getElementById("src").value,
            url: url,
	    type: 'hls'
        },
        pluginOptions:{
            hls:{
            },
        },
    });
    }
</script>
<script>
  const xhr = new XMLHttpRequest();
  xhr.open("GET", "https://raw.githubusercontent.com/linqingping/M3U8-player/master/sources.m3u8");
  xhr.onload = () => {
    const m3u8Text = xhr.responseText;
    const segments = [];
    let name;
    const lines = m3u8Text.split('\n');
    for (let i = 0; i < lines.length; i++) {
      if (lines[i].startsWith('#EXTINF:')) {
        name = lines[i].split(',')[1].trim();  
      } else if (lines[i].startsWith('https')) {  
        const url = lines[i];
        segments.push({
          name,
          url  
        });
        name = null;
      }
    } 
    //部署在github上只能使用https的源
    const div = document.getElementById("test")
    for (let i = 0; i < segments.length; i++) {
      const link = document.createElement('a');
      link.href = '#';
      link.style.display = 'inline-block';
      link.innerText = segments[i].name;
      link.onclick = () => changelive(segments[i].url,segments[i].name);
      div.appendChild(link);
    }

  }
  xhr.send();
</script>
